-
Notifications
You must be signed in to change notification settings - Fork 263
Fix two places where we write into vectors with ghosts. #6841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
I pushed another commit that should fix several more places. |
source/simulator/helper_functions.cc
Outdated
|
|
||
| // Set the velocity initial guess to zero. | ||
| current_linearization_point.block(introspection.block_indices.velocities) = 0; | ||
| // Set the velocity initial guess to zero. Do this via a vector |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While correct, this shows to me that your change in deal.II might be too restrictive. Not only do you need to add a comment and many lines of code, this also is going to be slower than before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps. I think zeroing out a vector might be a special case I'd be willing to consider to allow on a vector with ghost element, though I'm not 100% sure I know how to support that for all vectors. I'm happy to discuss this over in deal.II land. It would be easy to undo these changes here if we want to change semantics, given that these commits contain nothing else.
|
The remaining failures are The first two are in the Newton solver, which I would like to fix in a separate PR because it is entangled with @arnoldkk13 's #6804, which I need to think about. I don't know what's going on with In other words, my suggestion would be to consider this PR as complete and ready to merge if there is agreement about the direction. |
gassmoeller
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tend to agree with Timo's point.
current_linearization_point.block(introspection.block_indices.velocities) = 0;
is almost never a shorthand for:
for (unsigned int i=0; i<size; ++i)
current_linearization_point.block(introspection.block_indices.velocities)(i) = 0.0;
i.e. individually setting all entries to 0, which is not allowed for ghosted vectors. Instead it is semantically more similar to:
current_linearization_point.block(introspection.block_indices.velocities) = LinearAlgebra::Vector(introspection.index_sets.system_partitioning[introspection.block_indices.velocities],mpi_communicator);
i.e. reinitialize the whole vector to a new vector will all entries being zeroed out, which is already allowed for ghosted vectors. But I dont know about the different vector implementations and what it would entail to make this work.
For ASPECT I think we should just go ahead with these changes. Even if the changes in deal.II are modified and assignment of 0 is allowed the changes of this PR will still work, and the overhead cost should be small.
|
I would rather fix deal.II than putting a bandaid into ASPECT that we then need to remove again. |
|
I opened an issue over with deal.II about this. Of the three places this patch touches, only two create new vectors. For one, I pushed a commit that avoids the creation of the new vector -- we can just use |
We can leave things as they are currently. Additional logic to check if the vector is already zero doesn't seem worth it. |
This fixes two places where we get tripped up by the new rules that we can't write into vectors with ghosts, see #6822. There are more places, which I'll get to tomorrow -- it's close to midnight already...